/**
* 版权声明：厦门睿商网络科技有限公司 版权所有 违者必究
* 日    期：2020-04-27
*/
package com.rzico.basics.entity;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.rzico.annotation.IgnoreSwaggerParameter;
import com.rzico.basics.entity.Tag;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.persistence.Id;
import javax.persistence.Table;
import java.util.Collections;
import java.util.Date;
import java.util.List;

/**
 * <pre>
 *   会员卡数据库对象
 * </pre>
 * @author Rzico Boot
 * @version 1.0
 */
@Data
@JsonIgnoreProperties(value = {"handler"})
@JsonInclude(JsonInclude.Include.NON_NULL)
@Table(name = "wx_card")
public class Card{

    @Id
    @ApiModelProperty(value = "" )
    protected Long id;

    @ApiModelProperty(value = "创建日期" )
    protected Date createDate;

    @ApiModelProperty(value = "修改日期" )
    protected Date modifyDate;

    @ApiModelProperty(value = "余额" )
    protected java.math.BigDecimal balance;

    @ApiModelProperty(value = "卡号" )
    protected String code;

    @ApiModelProperty(value = "最近使用日期" )
    protected Date usedDate;

    @ApiModelProperty(value = "" )
    protected Long shopId;

    @ApiModelProperty(value = "状态 {0:空卡,1:正常,2:挂失}" )
    protected Integer status;

    @ApiModelProperty(value = "用户iid" )
    protected Long memberId;

    @ApiModelProperty(value = "企业id" )
    protected Long companyId;

    @ApiModelProperty(value = "福利卡有效开始日期" )
    protected Date startDate;

    @ApiModelProperty(value = "福利卡有效结束日期" )
    protected Date endDate;

    @ApiModelProperty(value = "客户备注" )
    protected String memo;

    @ApiModelProperty(value = "类型 {0:充值卡,1:福利卡}" )
    protected Integer cardType;

    @ApiModelProperty(value = "所属企业" )
    protected Long enterpriseId;


    @IgnoreSwaggerParameter
    @JsonIgnore
    protected Company company;

    protected List<Tag> tags = Collections.emptyList();

    public String getCompanyName() {
        Company company = getCompany();
        if (company!=null) {
            return company.getName();
        } else {
            return null;
        }
    }


    public void setCompanyName(String value) {

    }

}
